import { defineStore } from 'pinia'
import { ref } from 'vue'

interface CompanyInfo {
  name: string
  slogan: string
  logo?: string
  phone: string
  email: string
  website: string
  business: string
  qrcode?: string
}

export const useCompanyStore = defineStore('company', () => {
  // 企业信息
  const companyInfo = ref<CompanyInfo>({
    name: '引力琥珀',
    slogan: '语言的智能，才能替代智能语言',
    phone: '11111111',
    email: '5xxxxxx@qq.com',
    website: 'https://52d47b77.r34.cpolar.top',
    business: '我们的业务'
  })

  // 分享图片
  const shareImage = ref<string>('')

  // 设置企业信息
  const setCompanyInfo = (info: Partial<CompanyInfo>) => {
    companyInfo.value = {
      ...companyInfo.value,
      ...info
    }
  }

  // 设置分享图片
  const setShareImage = (imageUrl: string) => {
    shareImage.value = imageUrl
  }

  // 重置企业信息
  const resetCompanyInfo = () => {
    companyInfo.value = {
      name: '引力琥珀',
      slogan: '语言的智能，才能替代智能语言',
      phone: '11111111',
      email: '5xxxxxx@qq.com',
      website: 'https://52d47b77.r34.cpolar.top',
      business: '我们的业务'
    }
  }

  return {
    companyInfo,
    shareImage,
    setCompanyInfo,
    setShareImage,
    resetCompanyInfo
  }
})
